package com.xiaohong.user.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiaohong.user.fallback.ChatUsernameListFallback;
import com.xiaohong.user.fallback.ChatUsernameListFallback;
import com.xiaohong.user.pojo.UsernameList;
import entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name="user-service",contextId = "UsernameList",fallback= ChatUsernameListFallback.class)
public interface ChatUsernameListFeign {

    /***
     * 分页条件搜索实现UsernameList
     * @param UsernameList
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "/UsernameList/search/{page}/{size}")
    Result<Page> findPage(@RequestBody(required = false) UsernameList UsernameList, @PathVariable int page, @PathVariable int size);

    /***
     * 分页搜索实现UsernameList
     * @param page:当前页
     * @param size:每页显示多少条
     * @return
     */
    @GetMapping(value = "/UsernameList/search/{page}/{size}")
    Result<Page> findPage(@PathVariable int page, @PathVariable int size);

    /***
     * 多条件搜索UsernameList数据
     * @param UsernameList
     * @return
     */
    @PostMapping(value = "/UsernameList/search")
    Result<List<UsernameList>>findList(@RequestBody(required = false) UsernameList UsernameList);

    /***
     * 根据Id删除UsernameList数据
     * @param id
     * @return
     */
    @DeleteMapping(value = "/UsernameList/{id}")
    Result delete(@PathVariable Long id);

    /***
     * 根据ID修改UsernameList数据
     * @param UsernameList
     * @param id
     * @return
     */
    @PutMapping(value = "/UsernameList")
    Result update(@RequestBody UsernameList UsernameList);

    /***
     * 新增UsernameList数据
     * @param UsernameList
     * @return
     */
    @PostMapping(value = "/UsernameList")
    Result add(@RequestBody UsernameList UsernameList);

    /***
     * 根据ID查询UsernameList数据
     * @param id
     * @return
     */
    @GetMapping("/UsernameList/{id}")
    Result<UsernameList>findById(@PathVariable Long id);

    /***
     * 查询UsernameList全部数据
     * @return
     */
    @GetMapping(value = "/UsernameList")
    Result<List<UsernameList>>findAll();

}
